package com.atguigu.spring6iocxml.di;

public class Book {
    private String name;
    private String author;

    private String other;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOther() {
        return other;
    }

    public void setOther(String other) {
        this.other = other;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Book() {
        System.out.println("Book的无参构造方法");
    }

    public Book(String name, String author) {
        System.out.println("Book的有参构造方法");
        this.name = name;
        this.author = author;
    }

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", other='" + other + '\'' +
                '}';
    }

    public static void main(String[] args) {
        // 1、创建对象
        Book book = new Book();
        System.out.println(book.toString());

        // 2、创建对象
        Book book2 = new Book("Spring", "Rod Johnson");
        System.out.println(book2.name);
    }
}
